package com.qinker.robot.hook.aio.receive;

import com.alibaba.fastjson.JSON;
import com.qinker.robot.common.model.PrivateChatRequest;
import com.qinker.robot.hook.util.DingHookUtils;
import com.sky.xposed.common.util.Alog;

import java.util.List;

/**
 * Created by Irany 2019/10/29 15:41
 */
public class RobotRecipient {

    /**
     * 私聊
     */
    public void chat(PrivateChatRequest request) {
        DingHookUtils.getInstance().sendMessage(request);
    }

    /**
     * 群发私聊
     */
    public void chatMass(PrivateChatRequest request) {
        List<String> dingUidList = request.getDingUidList();
        request.setDingUidList(null);

        Alog.d("发送消息: " + JSON.toJSONString(dingUidList));
        for (String uid : dingUidList) {
            request.setDingUid(uid);
            DingHookUtils.getInstance().sendMessage(request);
        }
    }
}
